package com.jxwifi.cloud.quickcleanserver.mycenter;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.basicactivity.BasicActivity;
import com.idroid.widget.LoadDialog;
import com.jxwifi.cloud.quickcleanserver.R;
import com.jxwifi.cloud.quickcleanserver.app.CleanBasicActivity;
import com.jxwifi.cloud.quickcleanserver.app.StateUtils;
import com.jxwifi.cloud.quickcleanserver.bean.WithdraApplyBean;
import com.jxwifi.cloud.quickcleanserver.utils.TokenTimeUtils;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2019/5/24.
 */

public class PresentationDetailsActivity extends CleanBasicActivity {

    @Bind(R.id.tv_pre_details_bank_name)
    TextView mTvPreDetailsBankName;
    @Bind(R.id.tv_pre_details_price)
    TextView mTvPreDetailsPrice;
    @Bind(R.id.tv_pre_details_starts)
    TextView mTvPreDetailsStarts;
    @Bind(R.id.tv_per_details_order_number)
    TextView mTvPerDetailsOrderNumber;
    @Bind(R.id.tv_per_details_order_time)
    TextView mTvPerDetailsOrderTime;
    @Bind(R.id.tv_per_details_order_bank)
    TextView mTvPerDetailsOrderBank;
    @Bind(R.id.tv_per_details_payee)
    TextView mTvPerDetailsPayee;
    @Bind(R.id.tv_per_details_payee_account)
    TextView mTvPerDetailsPayeeAccount;
    private LoadDialog mLoadDialog;//加载动画
    private WithdraApplyBean mAskBean;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_presentation_details);
        ButterKnife.bind(this);
        openEventBus();
        mAskBean=(WithdraApplyBean) getIntent().getExtras().getSerializable("predetails");
        mLoadDialog = new LoadDialog(mBaseContext, "");
        mLoadDialog.show();
        initView();
    }

    @OnClick({R.id.rel_img_back_pressed})
    void clickCK(View v){
        switch (v.getId()){
            case R.id.rel_img_back_pressed:
                onBackPressed();
                break;
        }
    }

    public void initView(){
        mTvPreDetailsBankName.setText(mAskBean.getBankName());
        mTvPreDetailsPrice.setText(mAskBean.getAmount());
        if (StateUtils.WAITING.equals(mAskBean.getApprovalStatus())){
            mTvPreDetailsStarts.setText("处理中");
        }else if (StateUtils.YES.equals(mAskBean.getApprovalStatus())){
            mTvPreDetailsStarts.setText("已通过");
        }else if (StateUtils.NO.equals(mAskBean.getApprovalStatus())){
            mTvPreDetailsStarts.setText("未通过");
        }else if (StateUtils.LOAN.equals(mAskBean.getApprovalStatus())){
            mTvPreDetailsStarts.setText("已放款");
        }
        mTvPerDetailsOrderNumber.setText(mAskBean.getWithdrawApplyCode());
        if (!TextUtils.isEmpty(mAskBean.getCreateTime())){
            mTvPerDetailsOrderTime.setText(mAskBean.getCreateTime());
        }
        mTvPerDetailsOrderBank.setText(mAskBean.getBankName());
        mTvPerDetailsPayee.setText(mAskBean.getRealName());
        mTvPerDetailsPayeeAccount.setText(mAskBean.getBankNum());
        mLoadDialog.dismiss();
    }

}
